package game.ioc.home;

import game.database.base.DeletePlayerDB;
import game.database.base.UserPubDB;
import game.memc.base.human.PlayerDB;

import java.util.ArrayList;
import java.util.List;

import com.cs.city.bean.base.human.PlayerInfo;

public class UserIndexHivImp implements UserIndexHiv {

	/*
	 * (non-Javadoc)
	 * @see game.ioc.home.UserIndexHiv#getPlayerList(java.lang.String)
	 */
	public List<PlayerInfo> getPlayerList(String uId) {
		return PlayerDB.listContents(Long.valueOf(uId));
	}
	
	/*
	 * (non-Javadoc)
	 * @see game.ioc.home.UserIndexHiv#getDeletePLst(java.lang.String)
	 */
	public List<PlayerInfo> getDeletePLst(String uId) {
		List<String> pIdLst = DeletePlayerDB.getDeletePlayerLst(uId);
		List<PlayerInfo> pLst = new ArrayList<PlayerInfo>();
		
		for(String pId : pIdLst){
			PlayerInfo player = PlayerDB.getContent(Long.parseLong(pId));
			if(player != null){
				pLst.add(player);
			}
		}
		return pLst;
	} // getDeletePlayerLst()

	/* (non-Javadoc)
	 * @see game.ioc.home.UserIndexHiv#verifyUser(java.lang.String)
	 */
	public int verifyUser(String userId) {
		int isExit = 0;
		if(userId == null || userId.equals("")){
			return isExit;
		}
		
		if(UserPubDB.isUserExist(userId)){
			isExit = 1;
		}
		
//		if(UserDB.isUserExist(userId)){
//			isExit = 1;
//		}
		return isExit;
	} // verifyUser()
	
	
} // end of class
